export default class AnimationAction {
    constructor(frame, type, animation, data, prob) {
        this.frame = frame;
        this.type = type;
        this.animation = animation;
        this.data = data;
        this.probability = prob;
        this.isEnabled = true;
        this.frameSelector = null;
    }
}
AnimationAction.prototype.checkAction = function () {
    if (this.isEnabled && this.animation.currentFrame == this.frame && this.animation.isPlaying && Math.random() <= this.probability) {
        switch (this.type) {
            case 0:
                this.animation.stop();
                break;
            case 1:
                this.animation.gotoAndPlay(this.calcNextFrame());
                break;
            case 2:
                this.animation.gotoAndStop(this.data);
                break
        }
    }
};
AnimationAction.prototype.calcNextFrame = function () {
    var e = !this.frameSelector ? this.data : this.frameSelector.selectFrame(this.frame);
    if (e == -1)
        e = this.data;
    return e;
};
AnimationAction.prototype.setSelector = function (e) {
    this.frameSelector = e;
};
AnimationAction.prototype.setEnabled = function (e) {
    this.isEnabled = e;
};
AnimationAction.prototype.getEnabled = function () {
    return this.isEnabled;
};